﻿using Roton.Engine.Memory;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;

namespace Roton.Engine.Structures
{
    abstract class Board : IBoard
    {
        public BoardMemoryMap Memory { get; private set; }

        public Board(BoardMemoryMap memory)
        {
            this.Memory = memory;
        }

        virtual public int CameraX
        {
            get { return Memory.CameraX.Read(); }
            set { Memory.CameraX.Write(value.ToInt16()); }
        }

        virtual public int CameraY
        {
            get { return Memory.CameraY.Read(); }
            set { Memory.CameraY.Write(value.ToInt16()); }
        }

        virtual public int ExitEast
        {
            get { return Memory.ExitEast.Read(); }
            set { Memory.ExitEast.Write(value.ToByte()); }
        }

        virtual public int ExitNorth
        {
            get { return Memory.ExitNorth.Read(); }
            set { Memory.ExitNorth.Write(value.ToByte()); }
        }

        virtual public int ExitSouth
        {
            get { return Memory.ExitSouth.Read(); }
            set { Memory.ExitSouth.Write(value.ToByte()); }
        }

        virtual public int ExitWest
        {
            get { return Memory.ExitWest.Read(); }
            set { Memory.ExitWest.Write(value.ToByte()); }
        }

        abstract public int Height { get; }

        virtual public int IsDark
        {
            get { return Memory.IsDark.Read(); }
            set { Memory.IsDark.Write(value.ToByte()); }
        }

        virtual public int MaxPlayerShots
        {
            get { return Memory.MaxPlayerShots.Read(); }
            set { Memory.MaxPlayerShots.Write(value.ToByte()); }
        }

        virtual public string Name
        {
            get { return Memory.Name.Read(); }
            set { Memory.Name.Write(value); }
        }

        virtual public int PlayerEnterX
        {
            get { return Memory.PlayerEnterX.Read(); }
            set { Memory.PlayerEnterX.Write(value.ToByte()); }
        }

        virtual public int PlayerEnterY
        {
            get { return Memory.PlayerEnterY.Read(); }
            set { Memory.PlayerEnterY.Write(value.ToByte()); }
        }

        virtual public int RestartOnZap
        {
            get { return Memory.RestartOnZap.Read(); }
            set { Memory.RestartOnZap.Write(value.ToByte()); }
        }

        virtual public int TimeLimit
        {
            get { return Memory.TimeLimit.Read(); }
            set { Memory.TimeLimit.Write(value.ToInt16()); }
        }

        abstract public int Width { get; }
    }
}
